﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" 
    xmlns:Converters="clr-namespace:MvvmFx.Common.Converters;assembly=MvvmFx.Common" 
    xmlns:Views1="clr-namespace:MvvmFx.Samples.HowTos.ChangeTracking.Views" 
    x:Class="MvvmFx.Samples.HowTos.ChangeTracking.Views.ContactDetailsView" 
    Width="544" Height="462" >

    <UserControl.Resources>

    	<Converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>

    </UserControl.Resources>

    <Border Height="Auto" Width="Auto" BorderThickness="1,1,1,1" 
            Background="{DynamicResource brushes.pageBackground}" 
            BorderBrush="{DynamicResource brushes.pageBorder}" >

        <Grid x:Name="LayoutRoot" Height="Auto" Margin="0,0,0,0" Width="Auto">
            <Grid.RowDefinitions>
                <RowDefinition Height="20"/>
                <RowDefinition Height="40"/>
                <RowDefinition Height="23"/>
                <RowDefinition Height="34"/>
                <RowDefinition Height="34"/>
                <RowDefinition Height="34"/>
                <RowDefinition Height="34"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="40"/>
            </Grid.RowDefinitions>
            
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="78"/>
                <ColumnDefinition Width="112"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="90"/>
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Column="1" FontFamily="Verdana" FontSize="32" Text="contact details" TextWrapping="Wrap" Grid.ColumnSpan="2" VerticalAlignment="Center" Grid.RowSpan="1" Grid.Row="1" />
            <TextBlock Text="Customer Information" TextWrapping="Wrap" HorizontalAlignment="Stretch" VerticalAlignment="Center" FontFamily="Verdana" FontSize="14" Grid.ColumnSpan="3" Grid.Row="3" Grid.Column="1" d:LayoutOverrides="Height"/>
            <TextBlock Grid.Row="6" Text="Address Details" TextWrapping="Wrap" HorizontalAlignment="Stretch" FontFamily="Verdana" FontSize="14" Grid.ColumnSpan="3" Grid.Column="1" d:LayoutOverrides="Height" VerticalAlignment="Center"/>
            <TextBlock Grid.Row="4" Text="Email:" TextWrapping="Wrap"  Grid.Column="1" d:LayoutOverrides="Height"/>
            <TextBlock Grid.Row="5" Text="Tel. Number:" TextWrapping="Wrap" FontSize="12"  Grid.Column="1" d:LayoutOverrides="Height"/>
          
            <TextBox Text="{Binding EmailAddress, UpdateSourceTrigger=PropertyChanged}" Grid.Column="2" Grid.Row="4" Grid.ColumnSpan="1" d:LayoutOverrides="Height" VerticalAlignment="Center" Margin="5,0"/>
            <TextBox Text="{Binding TelNumber, UpdateSourceTrigger=PropertyChanged}"  Grid.Column="2" Grid.Row="5" Grid.ColumnSpan="1" d:LayoutOverrides="Height" VerticalAlignment="Center" Margin="5,0"/>

            <Views1:AddressView Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="7" 
                               DataContext="{Binding Address}"/>

            <Button Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="8"
                    Command="{Binding SaveCommand}" 
                    x:Name="btnSave" Width="38" Content="Save" Margin="0,0,0,0" VerticalAlignment="Center" Style="{DynamicResource SaveButtonStyle}" Height="48" HorizontalAlignment="Center" ToolTip="Save"/>
        
            <Image HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="3" 
                   Source="..\..\Images\Changed.png"
                   Visibility="{Binding ChangeService.IsModified, 
                   Converter={StaticResource BoolToVisibilityConverter}, FallbackValue=Visible}"/>
        	
            <Image HorizontalAlignment="Center" Grid.Row="6" 
                   Source="..\..\Images\Changed.png" 
                   VerticalAlignment="Center" d:LayoutOverrides="Height" 
                   Visibility="{Binding Address.ChangeService.IsModified, 
                   Converter={StaticResource BoolToVisibilityConverter}, FallbackValue=Visible}"/>
        </Grid>
    </Border>
</UserControl>
